package com.bocai.freeman.view.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.TextView;

import com.bocai.freeman.R;
import com.bocai.freeman.base.BaseFragment;
import com.bocai.freeman.view.activitys.DifinitionSkillActivity;
import com.bocai.freeman.view.adapter.SelectSkillAdapter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by admin on 2016/5/25.
 */
public class SelectSkillFrag extends BaseFragment {

    @Bind(R.id.gv)
    GridView mGv;
    @Bind(R.id.tv_difinition)
    TextView mTvDifinition;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_select_skill, null);
        ButterKnife.bind(this, view);
        initEvent();
        return view;
    }

    public void initEvent() {
        mGv.setAdapter(new SelectSkillAdapter(getContext()));
        click(mTvDifinition).subscribe(o -> {
            // TODO: 2016/5/25 to do something
            startActivity(new Intent(getActivity(), DifinitionSkillActivity.class));
        });
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
